// import React, { createContext } from 'react'
import { Modal, ModalFuncProps } from "antd"

// type ConfirmProps = {
// 	data: any
// 	config: ModalFuncProps
// 	onOk: () => void
// 	onCancel?: () => void
// }

const useConfirm = () => {
	// const Context = createContext()
	const [modal, contextHolder] = Modal.useModal()
	const confirm = async (config: ModalFuncProps) => {
		const res = await modal.confirm(config)
		return res
	}
	const info = async (config: ModalFuncProps) => {
		const res = await modal.info(config)
		return res
	}
	return {
		confirm,
		info,
		contextHolder
	}
}
export default useConfirm
